<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="keywords" content="">
        <meta name="deacription" content="">
        <link rel="stylesheet" href="./">
        <title></title>
        
    </head>
    <body>
        <div id="app">
            <p>{{num}}</p>
            <button @click="handleClick">按钮</button>
            <!-- 简写 -->
            <button @click="num++">按钮</button> 

            <form >
                <p>姓名：<input type="text" >
                <button type="submit" @click="login">登录</button></p>
            </form>
            <a href="http://baidu.com" @click="link">百度</a>
            <!-- 阻止默认事件 -->
            <form >
                <p>姓名：<input type="text" >
                <button type="submit" @click.prevent="login">登录</button></p>
            </form>
            <a href="http://baidu.com" @click.prevent="link">百度</a>

            <!--  -->
            <input type="text" @keyup="handleKeyup">
        </div>
        <script src="../js/vue.js"></script>
        <script>
            const vm = new Vue({
                data:{
                    num:0,
                },
                methods:{
                    handleClick(){
                        this.num++;
                    },
                    login(e){
                        // e.preventDefault();//阻止默认事件
                        console.log("login");
                    },
                    link(){
                        console.log("ling");
                    },
                },
            });
            vm.$mount("#app ")
        </script>
    </body>
</html>